package tw.edu.tku.im.maze;
import org.json.JSONException;
import org.json.JSONObject;


public class LeaveRoomReqParser extends PacketParser {
   public static LeaveRoomReqParser INSTANCE =  new LeaveRoomReqParser();
   
   private LeaveRoomReqParser() { }
   
   @Override
   public LeaveRoomReq parse(JSONObject jsonObj) throws JSONException {
      JSONObject parameter = jsonObj.getJSONObject("parameter");
      int roomID = parameter.getInt("roomID");
      String userID = parameter.getString("userID");
      int ticket = parameter.getInt("ticket");
      return new LeaveRoomReq(roomID, userID, ticket);
   }

   @Override
   public String acceptName() {
      return "leaveRoom";
   }

}
